inherited fmVizitStat: TfmVizitStat
  Left = 411
  Top = 195
  Width = 775
  Height = 683
  Caption = #1057#1090#1072#1090#1080#1089#1090#1080#1082#1072' '#1087#1086#1089#1077#1097#1077#1085#1080#1081
  Constraints.MinHeight = 683
  Constraints.MinWidth = 775
  OnShow = FormShow
  PixelsPerInch = 96
  TextHeight = 13
  inherited sbBottom: TStatusBar
    Top = 622
    Width = 767
  end
  inherited Panel1: TPanel
    Width = 767
    Visible = False
    inherited BitBtn1: TBitBtn
      Left = 597
    end
    inherited BitBtn2: TBitBtn
      Left = 685
    end
  end
  object Panel4: TPanel [2]
    Left = 0
    Top = 45
    Width = 767
    Height = 108
    Align = alTop
    TabOrder = 2
    DesignSize = (
      767
      108)
    object Label13: TLabel
      Left = 3
      Top = 1
      Width = 91
      Height = 16
      Caption = #1055#1086#1076#1088#1072#1079#1076#1077#1083#1077#1085#1080#1077
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clGray
      Font.Height = -13
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
    end
    object Label10: TLabel
      Left = 6
      Top = 47
      Width = 29
      Height = 16
      Align = alCustom
      Caption = #1044#1072#1090#1072
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clGray
      Font.Height = -13
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
    end
    object Label3: TLabel
      Left = 441
      Top = 47
      Width = 85
      Height = 13
      Caption = #1042#1089#1077#1075#1086' '#1088#1072#1073'. '#1095#1072#1089#1086#1074
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clGray
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
    end
    object Label4: TLabel
      Left = 543
      Top = 47
      Width = 81
      Height = 13
      Caption = #1042#1089#1077#1075#1086' '#1088#1072#1073'. '#1076#1085#1077#1081
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clGray
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
    end
    object Label1: TLabel
      Left = 277
      Top = 47
      Width = 55
      Height = 13
      Caption = #1042#1088#1077#1084#1103' '#1085#1072#1095'.'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clGray
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
    end
    object Label2: TLabel
      Left = 357
      Top = 47
      Width = 67
      Height = 13
      Caption = #1042#1088#1077#1084#1103' '#1086#1082#1086#1085#1095'.'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clGray
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
    end
    object eOsnPodrazd: TcxButtonEdit
      Tag = 555
      Left = 2
      Top = 17
      ParentFont = False
      Properties.Buttons = <
        item
          Glyph.Data = {
            F6000000424DF600000000000000760000002800000010000000100000000100
            0400000000008000000000000000000000001000000000000000000000000000
            8000008000000080800080000000800080008080000080808000C0C0C0000000
            FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFF0FFFFFFFFFFFFFF000FFFFFFFFFFFF00000FFFFFFFFFF0000000F
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}
        end>
      Properties.MaxLength = 0
      Properties.ReadOnly = True
      Properties.OnButtonClick = eOsnPodrazdPropertiesButtonClick
      Properties.OnChange = eOsnPodrazdPropertiesChange
      Style.Font.Charset = DEFAULT_CHARSET
      Style.Font.Color = clWindowText
      Style.Font.Height = -13
      Style.Font.Name = 'Tahoma'
      Style.Font.Style = [fsBold]
      Style.LookAndFeel.SkinName = ''
      Style.Shadow = True
      Style.IsFontAssigned = True
      StyleDisabled.LookAndFeel.SkinName = ''
      StyleFocused.LookAndFeel.SkinName = ''
      StyleHot.LookAndFeel.SkinName = ''
      TabOrder = 0
      Width = 591
    end
    object cxButton6: TcxButton
      Tag = 12
      Left = 600
      Top = 17
      Width = 27
      Height = 26
      Hint = #1054#1095#1080#1089#1090#1080#1090#1100
      ParentShowHint = False
      ShowHint = True
      TabOrder = 1
      TabStop = False
      OnClick = cxButton6Click
      Glyph.Data = {
        76010000424D7601000000000000760000002800000020000000100000000100
        0400000000000001000000000000000000001000000000000000000000000000
        8000008000000080800080000000800080008080000080808000C0C0C0000000
        FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
        3333333333333333333333333333333333333333333333333333333333333333
        3333333333333333333333337333333333333333F33333333333333313333333
        333333337F33333333333333113333713333333377F33377F333333371733717
        3333333377F3377F333333333117311333333333377F377F3333333337111133
        33333333337777F33333333337111333333333333F777F333333333371111733
        3333333337777F3333333333117311733333333377F377F33333333333333117
        333333333333377F33333333333333117333333333333377F333333333333333
        3333333333333333333333333333333333333333333333333333}
      LookAndFeel.SkinName = ''
      NumGlyphs = 2
    end
    object bSearchNow: TcxButton
      Tag = 12
      Left = 645
      Top = 24
      Width = 112
      Height = 65
      Hint = #1054#1095#1080#1089#1090#1080#1090#1100
      Anchors = [akTop, akRight]
      Caption = #1056#1072#1089#1095#1077#1090
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -19
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
      ParentShowHint = False
      ShowHint = True
      TabOrder = 2
      TabStop = False
      OnClick = bSearchNowClick
      LookAndFeel.SkinName = 'Blue'
    end
    object eDate: TcxButtonEdit
      Tag = 11
      Left = 5
      Top = 65
      ParentFont = False
      Properties.Buttons = <
        item
          Glyph.Data = {
            F6000000424DF600000000000000760000002800000010000000100000000100
            0400000000008000000000000000000000001000000000000000000000000000
            8000008000000080800080000000800080008080000080808000C0C0C0000000
            FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFF0FFFFFFFFFFFFFF000FFFFFFFFFFFF00000FFFFFFFFFF0000000F
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
            FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}
        end>
      Properties.MaxLength = 0
      Properties.ReadOnly = True
      Properties.OnButtonClick = eDatePropertiesButtonClick
      Properties.OnChange = eOsnPodrazdPropertiesChange
      Style.Font.Charset = DEFAULT_CHARSET
      Style.Font.Color = clWindowText
      Style.Font.Height = -13
      Style.Font.Name = 'Tahoma'
      Style.Font.Style = [fsBold]
      Style.LookAndFeel.SkinName = ''
      Style.Shadow = True
      Style.IsFontAssigned = True
      StyleDisabled.LookAndFeel.SkinName = ''
      StyleFocused.LookAndFeel.SkinName = ''
      StyleHot.LookAndFeel.SkinName = ''
      TabOrder = 3
      Width = 260
    end
    object edH: TDBEdit
      Left = 439
      Top = 65
      Width = 89
      Height = 27
      TabStop = False
      Color = clMoneyGreen
      DataField = 'RAB_CHASY'
      DataSource = dsWD
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clBlack
      Font.Height = -16
      Font.Name = 'Tahoma'
      Font.Style = [fsBold]
      ParentFont = False
      ReadOnly = True
      TabOrder = 4
    end
    object edD: TDBEdit
      Left = 543
      Top = 65
      Width = 89
      Height = 27
      TabStop = False
      Color = clMoneyGreen
      DataField = 'RAB_DEN'
      DataSource = dsWD
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clBlack
      Font.Height = -16
      Font.Name = 'Tahoma'
      Font.Style = [fsBold]
      ParentFont = False
      ReadOnly = True
      TabOrder = 5
    end
    object teBegin: TcxTimeEdit
      Left = 276
      Top = 64
      EditValue = 0.333333333333333d
      ParentFont = False
      Properties.TimeFormat = tfHourMin
      Properties.OnChange = eOsnPodrazdPropertiesChange
      Style.Font.Charset = DEFAULT_CHARSET
      Style.Font.Color = clWindowText
      Style.Font.Height = -16
      Style.Font.Name = 'Tahoma'
      Style.Font.Style = []
      Style.Shadow = True
      Style.IsFontAssigned = True
      TabOrder = 6
      Width = 73
    end
    object teEnd: TcxTimeEdit
      Left = 356
      Top = 64
      EditValue = 0.833333333333333d
      ParentFont = False
      Properties.TimeFormat = tfHourMin
      Properties.OnChange = eOsnPodrazdPropertiesChange
      Style.Font.Charset = DEFAULT_CHARSET
      Style.Font.Color = clWindowText
      Style.Font.Height = -16
      Style.Font.Name = 'Tahoma'
      Style.Font.Style = []
      Style.Shadow = True
      Style.IsFontAssigned = True
      TabOrder = 7
      Width = 73
    end
  end
  object dbgStat: TcxGrid [3]
    Left = 0
    Top = 153
    Width = 767
    Height = 469
    Align = alClient
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    TabOrder = 3
    LookAndFeel.Kind = lfStandard
    object tvStat: TcxGridDBTableView
      NavigatorButtons.ConfirmDelete = False
      NavigatorButtons.First.Visible = True
      NavigatorButtons.PriorPage.Visible = True
      NavigatorButtons.Prior.Visible = True
      NavigatorButtons.Next.Visible = True
      NavigatorButtons.NextPage.Visible = True
      NavigatorButtons.Last.Visible = True
      NavigatorButtons.Insert.Visible = False
      NavigatorButtons.Append.Visible = False
      NavigatorButtons.Delete.Visible = False
      NavigatorButtons.Edit.Visible = False
      NavigatorButtons.Post.Visible = False
      NavigatorButtons.Cancel.Visible = False
      NavigatorButtons.Refresh.Visible = False
      NavigatorButtons.SaveBookmark.Visible = False
      NavigatorButtons.GotoBookmark.Visible = False
      NavigatorButtons.Filter.Visible = False
      DataController.DataSource = dlgDS
      DataController.Summary.DefaultGroupSummaryItems = <>
      DataController.Summary.FooterSummaryItems = <
        item
          Format = '#,##0.00'
          Kind = skSum
          FieldName = 'D'
          Column = tvStatD
        end
        item
          Format = '#,##0.00'
          Kind = skSum
          FieldName = 'H'
          Column = tvStatH
        end
        item
          Kind = skSum
          FieldName = 'D1'
          Column = tvStatD1
        end
        item
          Kind = skSum
          FieldName = 'H1'
          Column = tvStatH1
        end
        item
          Kind = skCount
          FieldName = 'PP'
          Column = tvStatPP
        end>
      DataController.Summary.SummaryGroups = <>
      OptionsBehavior.CellHints = True
      OptionsBehavior.IncSearch = True
      OptionsCustomize.ColumnFiltering = False
      OptionsData.CancelOnExit = False
      OptionsData.Deleting = False
      OptionsData.DeletingConfirmation = False
      OptionsData.Editing = False
      OptionsData.Inserting = False
      OptionsView.CellEndEllipsis = True
      OptionsView.NavigatorOffset = 10
      OptionsView.NoDataToDisplayInfoText = '<'#1053#1077#1090' '#1076#1072#1085#1085#1099#1093'>'
      OptionsView.CellTextMaxLineCount = 1
      OptionsView.ColumnAutoWidth = True
      OptionsView.Footer = True
      OptionsView.GroupByBox = False
      OptionsView.Indicator = True
      OptionsView.ShowColumnFilterButtons = sfbAlways
      Preview.Visible = True
      Styles.IncSearch = DMInv.cxKrasniyText
      Styles.Selection = DMInv.cxJoltiyFon
      Styles.Header = DMInv.cxSiniyText
      object tvStatPP: TcxGridDBColumn
        Caption = #1060#1048#1054
        DataBinding.FieldName = 'PP'
        Width = 262
      end
      object tvStatH1: TcxGridDBColumn
        Caption = #1042#1089#1077#1075#1086' '#1095#1072#1089'.'
        DataBinding.FieldName = 'H1'
        Width = 92
      end
      object tvStatD1: TcxGridDBColumn
        Caption = #1042#1089#1077#1075#1086' '#1076#1085'.'
        DataBinding.FieldName = 'D1'
        Width = 93
      end
      object tvStatH: TcxGridDBColumn
        Caption = #1063#1072#1089#1099
        DataBinding.FieldName = 'H'
        Width = 113
      end
      object tvStatD: TcxGridDBColumn
        Caption = #1044#1085#1080
        DataBinding.FieldName = 'D'
        Width = 110
      end
    end
    object cxGridLevel4: TcxGridLevel
      GridView = tvStat
    end
  end
  inherited dlgDS: TDataSource
    DataSet = qStat
    Left = 48
    Top = 160
  end
  object qStat: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    CachedUpdates = True
    SQL.Strings = (
      
        'SELECT CAST('#39#39' AS VARCHAR(1024)) AS PP, CAST(0 AS NUMERIC(18,2))' +
        ' AS h, CAST(0 AS NUMERIC(18,2)) AS d,'
      'CAST(0 AS INTEGER) AS h1, CAST(0 AS INTEGER) AS d1'
      'FROM PEOPLE P'
      'WHERE P.PID = -1')
    UpdateObject = IBUpdateSQL1
    Left = 168
    Top = 136
    object qStatPP: TIBStringField
      FieldName = 'PP'
      ProviderFlags = []
      Size = 1024
    end
    object qStatH: TIBBCDField
      FieldName = 'H'
      ProviderFlags = []
      DisplayFormat = '#,##0.00'
      Precision = 18
      Size = 2
    end
    object qStatD: TIBBCDField
      FieldName = 'D'
      ProviderFlags = []
      DisplayFormat = '#,##0.00'
      Precision = 18
      Size = 2
    end
    object qStatH1: TIntegerField
      FieldName = 'H1'
      ProviderFlags = []
    end
    object qStatD1: TIntegerField
      FieldName = 'D1'
      ProviderFlags = []
    end
  end
  object IBUpdateSQL1: TIBUpdateSQL
    InsertSQL.Strings = (
      'insert into people (pp, h, d) values (:pp, :h, :d)')
    Left = 200
    Top = 136
  end
  object qSel: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    AfterOpen = qSelAfterOpen
    SQL.Strings = (
      'SELECT dp.pid,'
      
        '       (COALESCE(p.plastname, '#39' '#39') || '#39' '#39' || COALESCE(p.pname, '#39 +
        ' '#39') || '#39' '#39' || COALESCE(p.ppatronymic, '#39' '#39')) AS pp,'
      
        '       SUM(IIF(DATEDIFF(DAY FROM CAST(v.pvtime_in AS DATE) TO II' +
        'F(CAST(v.pvtime_out AS DATE) > CAST(:dateend AS DATE), CAST(:dat' +
        'eend AS DATE) + 1, CAST(v.pvtime_out AS DATE))) = 0,'
      '        --'#1077#1089#1083#1080' '#1087#1086#1089#1077#1097#1077#1085#1080#1077' '#1074' '#1087#1088#1077#1076#1077#1083#1072#1093' '#1089#1091#1090#1086#1082
      
        '        DATEDIFF(HOUR FROM IIF(CAST(v.pvtime_in AS TIME) < TIME ' +
        #39'08:00'#39', TIME '#39'08:00'#39', CAST(v.pvtime_in AS TIME) ) TO IIF(CAST(v' +
        '.PVTIME_OUT AS TIME) > TIME '#39'20:00'#39', TIME '#39'20:00'#39', CAST(v.PVTIME' +
        '_OUT AS TIME))),'
      '        --'#1077#1089#1083#1080' '#1074#1099#1093#1086#1076#1080#1090' '#1079#1072' '#1087#1088#1077#1076#1077#1083#1099' '#1089#1091#1090#1086#1082
      
        '        DATEDIFF(HOUR FROM IIF(CAST(v.pvtime_in AS TIME) < TIME ' +
        #39'08:00'#39', TIME '#39'08:00'#39', CAST(v.pvtime_in AS TIME) ) TO  TIME '#39'20:' +
        '00'#39') +'
      
        '        DATEDIFF(HOUR FROM TIME '#39'08:00'#39' TO  IIF(CAST(v.PVTIME_OU' +
        'T AS TIME) > TIME '#39'20:00'#39', TIME '#39'20:00'#39', CAST(v.PVTIME_OUT AS TI' +
        'ME))) +'
      
        '        (DATEDIFF(DAY FROM CAST(v.pvtime_in AS DATE) TO IIF(CAST' +
        '(v.pvtime_out AS DATE) > CAST(:dateend AS DATE), CAST(:dateend A' +
        'S DATE) + 1, CAST(v.pvtime_out AS DATE)))-1)*12'
      '        )) AS h,'
      
        '       SUM(IIF(DATEDIFF(HOUR FROM v.pvtime_in TO v.pvtime_out) >' +
        ' 4, IIF(CAST(v.pvtime_out AS DATE) > CAST(v.pvtime_in AS DATE),'
      
        '                IIF(DATEDIFF(DAY FROM CAST(v.pvtime_in AS DATE) ' +
        'TO IIF(CAST(v.pvtime_out AS DATE) > CAST(:dateend AS DATE), CAST' +
        '(:dateend AS DATE) + 1, CAST(v.pvtime_out AS DATE))) = 0, 1, DAT' +
        'EDIFF(DAY FROM CAST(v.pvtime_in AS DATE) TO IIF(CAST(v.pvtime_ou' +
        't AS DATE) > CAST(:dateend AS DATE), CAST(:dateend AS DATE) + 1,' +
        ' CAST(v.pvtime_out AS DATE)))), 1),0)) AS d'
      'FROM deti_podrazd dp'
      'INNER JOIN people p ON p.pid = dp.pid'
      'INNER JOIN p_vizit v ON v.pid = dp.pid'
      
        'WHERE CAST(v.pvtime_in AS DATE) BETWEEN :datebegin AND :dateend ' +
        'AND'
      
        '      CAST(v.pvtime_in AS DATE) BETWEEN CAST(dp.dpdatein AS DATE' +
        ') AND COALESCE(CAST(dp.dpdateout AS DATE), CURRENT_DATE + 3650) ' +
        'AND'
      
        '      dp.sdid IN (1401, 1407, 1408, 1437, 1511, 1512, 1513, 1514' +
        ', 1516, 1517, 1519, 1518, 1520, 1521, 1523, 1522, 1524, 1527, 15' +
        '28, 1529, 1530, 1525, 1526)'
      'GROUP BY 1, 2  ')
    Left = 168
    Top = 176
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'dateend'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'dateend'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'dateend'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'dateend'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'dateend'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'dateend'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'dateend'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'dateend'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'datebegin'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'dateend'
        ParamType = ptUnknown
      end>
    object qSelPID: TIntegerField
      FieldName = 'PID'
      Origin = '"DETI_PODRAZD"."PID"'
    end
    object qSelPP: TIBStringField
      FieldName = 'PP'
      ProviderFlags = []
      Size = 767
    end
    object qSelH: TLargeintField
      FieldName = 'H'
      ProviderFlags = []
      DisplayFormat = '#,##0.00'
    end
    object qSelD: TLargeintField
      FieldName = 'D'
      ProviderFlags = []
      DisplayFormat = '#,##0.00'
    end
  end
  object qWD: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      
        'SELECT COUNT(WD.WDID) AS rab_den, (COUNT(WD.WDID)*DATEDIFF(HOUR ' +
        'FROM CAST(:timebegin as TIME) TO CAST(:timeend as TIME))) AS rab' +
        '_chasy'
      'FROM WORKDAYS WD'
      'WHERE WD.WDDATE BETWEEN :datebegin AND :dateend'
      'AND WD.WDISHOLIDAY = 0')
    Left = 168
    Top = 216
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'timebegin'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'timeend'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'datebegin'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'dateend'
        ParamType = ptUnknown
      end>
    object qWDRAB_DEN: TIntegerField
      FieldName = 'RAB_DEN'
      ProviderFlags = []
    end
    object qWDRAB_CHASY: TLargeintField
      FieldName = 'RAB_CHASY'
      ProviderFlags = []
    end
  end
  object dsWD: TDataSource
    DataSet = qWD
    Left = 200
    Top = 216
  end
end
